"""
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    created by lane.chang on '28/05/2024'
    comment: 用户意图接口
"""
from fastapi import APIRouter, Request

from config import Config
from project.lib.decorator import api_common, exec_duration
from project.core.function import json_response
from project.service.intent import Intent

basic_router = APIRouter(prefix='', tags=['Basic'])


@basic_router.get('/basic/intention/list', summary='意图列表')
@api_common(doc_replace=(('{0}', Config.HTTP_DOC_FIX),))
@exec_duration(add_return=True)
async def get_intention_list(request: Request):
    """
    **desc**: 取得用户意图列表

    **url**: http(s)://{0}.udicaria.com/intent

    **method**: GET

    **params**:

    **return**:json数据结构::

        {
            code: 0(成功)/非0(失败)
            message: 成功返回success, 否则返回error信息
            data: [
            ]
            exec_time: 接口后端处理时长
        }

    """
    return json_response(data=Intent.list())
